package com.rojored.controls 
{

import spark.components.VideoDisplay;

/**
 *  VideoDisplay extension that additionaly exposes a <code>smoothing</code>
 *  property.
 */
public class VideoDisplay extends  spark.components.VideoDisplay
{

    //--------------------------------------------------------------------------
    //
    //  Constructor
    //
    //--------------------------------------------------------------------------

    /**
     *  Constructor
     */
    public function VideoDisplay() 
    {
        super();
    }

    //--------------------------------------------------------------------------
    //
    //  Properties
    //
    //--------------------------------------------------------------------------
    
    //--------------------------------------
    //  smoothing 
    //--------------------------------------
    
    /**
     *  @private
     *  Storage for the smoothing property
     */
    private var _smoothing:Boolean;

    /**
     *  If <code>true</code>
     */
    public function get smoothing():Boolean
    {
        return _smoothing;
    }

    /**
     *  @private
     */
    public function set smoothing(value:Boolean):void
    {
        if (_smoothing == value)
            return;

        _smoothing = value;
        invalidateProperties();
    }
    
    //--------------------------------------
    // source 
    //--------------------------------------

    [Bindable("sourceChanged")]

    /**
     *  Media soure.
     */
    override public function get source():Object
    {
        return super.source;
    }

    /**
     *  @private
     */
    override public function set source(value:Object):void
    {
        super.source = value;

        // Make sure smpoothing is applied when source changes otherwise
        // smoothing won't be applied the first time.
        invalidateProperties();
    }
    
    //--------------------------------------------------------------------------
    //
    //  Overriden methods: UIComponentc 
    //
    //--------------------------------------------------------------------------
    
    /**
     *  @private
     */
    override protected function commitProperties():void
    {
        super.commitProperties();
        if (videoObject && videoObject.smoothing != smoothing)
            videoObject.smoothing = smoothing;
    }
}
}
